import request from '../utils/request'

/**
 * 分页条件查询全部
 * @returns {AxiosPromise}
 */
export const findAll = (current, size, userVo) => {
  return request({
    url: '/system/user/findAll',
    method: 'post',
    params: {
      current,
      size
    },
    data: userVo
  })
}

/**
 * 根据用户id进行删除
 * @param id
 * @returns {AxiosPromise}
 */
export const delById = (id) => {
  return request({
    url: '/system/user/delById',
    method: 'post',
    params: {
      id
    }
  })
}


/**
 * 删除oss中的图片
 * @param file
 * @returns {AxiosPromise}
 */
export const deleteImgFile = (file) => {
  return request({
    url: '/deleteImgFile',
    method: 'post',
    params: {
      file
    }
  })
}

/**
 * 添加用户
 * @param user
 * @returns {AxiosPromise}
 * @constructor
 */
export const AddUser = (user)=>{
  return request({
    url: '/system/user/AddUser',
    method: 'post',
    data: user
  })
}

/**
 * 根据id查询用户信息
 * @param id
 * @returns {AxiosPromise}
 */
export const findById = (id) =>{
  return request({
    url: '/system/user/findById',
    method: 'get',
    params:{
      id
    }
  })
}

/**
 * 修改用户信息
 * @param user
 * @returns {AxiosPromise}
 */
export const updateUser = (user) =>{
  return request({
    url: '/system/user/updateUser',
    method: 'post',
    data:user
  })
}

/**
 * 导出用户excel
 * @param userVo
 * @returns {AxiosPromise}
 */
export const exportUserExcel = (userVo) => {
  return request({
    url: '/system/user/export',
    method: 'post',
    data:userVo,
    responseType:"blob"
  })
}
